﻿/**
* @description  Abstract class for all animators.
*/
package com.foed.animation {

	import flash.events.EventDispatcher;
	import flash.utils.Timer;

	public class Animator extends EventDispatcher {
	
		public static var intervalTime:Number = 30;
		protected var _timer:Timer;
	
		/**
		* @description	Adds a listener for an event. Overridden to set useWeakReference to true.
		*
		* @param  pType  Inherited from Sprite. See AS3 docs.
		* @param  pListener  Inherited from Sprite. See AS3 docs.
		* @param  pUseCapture  Inherited from Sprite. See AS3 docs.
		* @param  pPriority  Inherited from Sprite. See AS3 docs.
		* @param  pUseWeakReference  Inherited from Sprite. See AS3 docs.
		*
		* @returns  A value of true if the event was successfully dispatched. A value of false indicates failure or that preventDefault() was called on the event.
		*/	
		override public function addEventListener(
			pType:String,
			pListener:Function,
			pUseCapture:Boolean=false,
			pPriority:int=0,
			pUseWeakReference:Boolean=true
		):void {
			super.addEventListener(pType, pListener, pUseCapture, pPriority, pUseWeakReference);
		}

		/**
		* @description  Starts the animation.
		*/
		public function start():void {}

		/**
		* @description  Stops the animation.
		*/
		public function halt():void {}
		
		/**
		* @description  Cleans up any timers that might be running.
		*/
		public function die():void {
			halt();
			_timer = null;
		}
	
	}
	
}